From 96baa92231e89c717ba369f00441e2373ab821f7 Mon Sep 17 00:00:00 2001 From: "awilliam@xenbuild2.aw" Date: Wed, 14 Feb 2007 10:14:37 -0700 Subject: [PATCH] [IA64] Fix serial console on Tiger2 & Tiger4 I inadvertently broke the serial console on Intel Tiger systems by assuming they were registering a com1 at 0x3f8. Instead, unconditionally register both com ports (the ns16550 driver will throw away any that don't have baud == 0) and create a function to detect the Tiger systems. This should setup reasonable default com port values, but they can still be superceded using com1= and com2= boot time parameters. Signed-off-by: Alex Williamson --- xen/arch/ia64/linux-xen/setup.c | 72 +++++++++++++++++++++++++++++++++ xen/arch/ia64/xen/pcdp.c | 2 +- xen/arch/ia64/xen/xensetup.c | 9 +---- 3 files changed, 74 insertions(+), 9 deletions(-) diff --git a/xen/arch/ia64/linux-xen/setup.c b/xen/arch/ia64/linux-xen/setup.c index c7744eddd4..b82e9a7b23 100644 --- a/xen/arch/ia64/linux-xen/setup.c +++ b/xen/arch/ia64/linux-xen/setup.c @@ -314,6 +314,74 @@ io_port_init (void) num_io_spaces = 1; } +#ifdef XEN +static int __init +intel_tiger_console_setup(void) +{ + extern struct ns16550_defaults ns16550_com1, ns16550_com2; + efi_system_table_t *systab; + efi_config_table_t *tables; + struct acpi20_table_rsdp *rsdp = NULL; + struct acpi_table_xsdt *xsdt; + struct acpi_table_header *hdr; + int i; + + /* Don't duplicate setup if an HCDP table is present */ + if (efi.hcdp) + return -ENODEV; + + /* Manually walk firmware provided tables to get to the XSDT. */ + systab = __va(ia64_boot_param->efi_systab); + + if (!systab || systab->hdr.signature != EFI_SYSTEM_TABLE_SIGNATURE) + return -ENODEV; + + tables = __va(systab->tables); + + for (i = 0 ; i < (int)systab->nr_tables && !rsdp ; i++) { + if (efi_guidcmp(tables[i].guid, ACPI_20_TABLE_GUID) == 0) + rsdp = + (struct acpi20_table_rsdp *)__va(tables[i].table); + } + + if (!rsdp || strncmp(rsdp->signature, RSDP_SIG, sizeof(RSDP_SIG) - 1)) + return -ENODEV; + + xsdt = (struct acpi_table_xsdt *)__va(rsdp->xsdt_address); + hdr = &xsdt->header; + + if (strncmp(hdr->signature, XSDT_SIG, sizeof(XSDT_SIG) - 1)) + return -ENODEV; + + /* Only looking for Intel systems */ + if (strncmp(hdr->oem_id, "INTEL", 5)) + return -ENODEV; + + if (!strncmp(hdr->oem_table_id, "SR870BH2", 8)) { + /* Tiger 2 */ + ns16550_com1.baud = BAUD_AUTO; + ns16550_com1.io_base = 0x3f8; + ns16550_com1.irq = 4; + + ns16550_com2.baud = BAUD_AUTO; + ns16550_com2.io_base = 0x2f8; + ns16550_com2.irq = 3; + + return 0; + + } else if (!strncmp(hdr->oem_table_id, "SR870BN4", 8)) { + /* Tiger 4 */ + ns16550_com1.baud = BAUD_AUTO; + ns16550_com1.io_base = 0x2f8; + ns16550_com1.irq = 3; + + return 0; + } + + return -ENODEV; +} +#endif + /** * early_console_setup - setup debugging console * @@ -344,6 +412,10 @@ early_console_setup (char *cmdline) earlycons++; #endif +#ifdef XEN + if (!intel_tiger_console_setup()) + earlycons++; +#endif return (earlycons) ? 0 : -1; } diff --git a/xen/arch/ia64/xen/pcdp.c b/xen/arch/ia64/xen/pcdp.c index 4f968cd330..d519c07708 100644 --- a/xen/arch/ia64/xen/pcdp.c +++ b/xen/arch/ia64/xen/pcdp.c @@ -140,7 +140,7 @@ static int __init setup_serial_console(struct pcdp *pcdp, struct pcdp_uart *uart) { - ns16550_com1.baud = uart->baud; + ns16550_com1.baud = uart->baud ? uart->baud : BAUD_AUTO; ns16550_com1.io_base = uart->addr.address; if (uart->bits) ns16550_com1.data_bits = uart->bits; diff --git a/xen/arch/ia64/xen/xensetup.c b/xen/arch/ia64/xen/xensetup.c index 8909136b26..c769221230 100644 --- a/xen/arch/ia64/xen/xensetup.c +++ b/xen/arch/ia64/xen/xensetup.c @@ -147,7 +147,6 @@ void early_cmdline_parse(char **cmdline_p) } struct ns16550_defaults ns16550_com1 = { - .baud = BAUD_AUTO, .data_bits = 8, .parity = 'n', .stop_bits = 1 @@ -158,7 +157,6 @@ unsigned int ns16550_com1_polarity; unsigned int ns16550_com1_trigger; struct ns16550_defaults ns16550_com2 = { - .baud = BAUD_AUTO, .data_bits = 8, .parity = 'n', .stop_bits = 1 @@ -271,12 +269,7 @@ void start_kernel(void) hpsim_serial_init(); else { ns16550_init(0, &ns16550_com1); - if (ns16550_com1.io_base == 0x3f8) { - /* Also init com2 for Tiger4. */ - ns16550_com2.io_base = 0x2f8; - ns16550_com2.irq = 3; - ns16550_init(1, &ns16550_com2); - } + ns16550_init(1, &ns16550_com2); } serial_init_preirq(); -- 2.30.2